import { ApiProperty } from '@nestjs/swagger';
import { LogLevel } from '../../../constants/log.constant';
import { HttpMethod } from '../../../constants/user-activity-log.constant';

class GetUserActivityLogAdminResDtoData {
  @ApiProperty({ description: '日志id' })
  readonly id: number;

  @ApiProperty({ description: '日志级别', enum: LogLevel })
  readonly level: LogLevel;

  @ApiProperty({ description: '请求方法', enum: HttpMethod })
  readonly method: HttpMethod;

  @ApiProperty({ description: '操作人uuid' })
  readonly user_uuid: string;

  @ApiProperty({ description: '请求来源ip' })
  readonly ip: string;

  @ApiProperty({ description: '请求URL' })
  readonly url: string;

  @ApiProperty({ description: '请求信息' })
  readonly request_message: string;

  @ApiProperty({ description: '返回状态码' })
  readonly response_code: number;

  @ApiProperty({ description: '返回信息' })
  readonly response_message: string;

  @ApiProperty({ description: '请求执行时间(单位:毫秒)' })
  readonly interval: number;

  @ApiProperty({ description: '创建时间' })
  readonly created_at: Date;
}

export class GetUserActivityLogAdminResDto {
  @ApiProperty({ description: '总条数' })
  readonly total_count: number;

  @ApiProperty({ description: '日志列表', type: GetUserActivityLogAdminResDtoData, isArray: true })
  readonly data: GetUserActivityLogAdminResDtoData[];
}
